<!DOCTYPE html><html><head><title>Ext.JSON | Ext JS 4.0 Documentation</title><script type="text/javascript" src="../ext-all.js"></script><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../scrollbars.css" type="text/css"><link rel="stylesheet" href="../docs.css" type="text/css"><link id="styleCss" rel="stylesheet" href="../style.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script><link rel="stylesheet" href="../prettify.css" type="text/css"><!-- link(rel: 'stylesheet', href: req.baseURL + '/css/ext4.css', type: 'text/css')--><link rel="shortcut icon" type="image/ico" href="../favicon.ico"><!--[if IE]>
<style type="text/css">.head-band { display: none; }
.header { border: 0; top: 0; left: 0px; background: url(../header.gif) repeat-x; }
.doc-tab .members .member a.more { background-color: #efefef; }
</style><link rel="stylesheet" href="/new/css/ie.css" type="text/css"><![endif]-->
</head><body id="ext-body" class="iScroll"><div id="notice" class="notice">For up to date documentation and features, visit 
<a href="http://docs.sencha.com/ext-js/4-0">http://docs.sencha.com/ext-js/4-0</a></div><div class="wrapper"><div class="head-band"></div><div class="header"><h2><a href="../index.html">Sencha Documentation</a></h2></div><div id="search"><form><input type="text" placeholder="Search" id="search-field" autocomplete="off" name="q"></form><div id="search-box"></div></div><div id="treePanel"></div><div id="container"><script type="text/javascript">

    req = {
        liveURL: '.',
        standAloneMode: true,
        origDocClass: 'Ext.JSON',
        docClass: 'Ext.JSON',
        docReq: 'Ext.JSON',
        version: '4.0',
        baseURL: '.',
        baseDocURL: '.',
        baseProdURL: '.'
    };

    clsInfo = {};



</script>

<script type="text/javascript" src="../search.js"></script>
<!--script type="text/javascript" src="/new/javascripts/app/examples.js"></script-->
<script type="text/javascript" src="../class_tree.js"></script>
<script type="text/javascript" src="../class_doc.js"></script>
<script type="text/javascript">
    req.source = 'JSON3.html#Ext-JSON';
    clsInfo = {"methods":["decode","encode","encodeDate"],"cfgs":[],"properties":[],"events":[],"subclasses":[]};
    Ext.onReady(function() {
        Ext.create('Docs.classPanel');
    });
</script><div id="top-block" class="top-block"><h1 id="clsTitle" class="cls"><a href="../source/JSON3.html#Ext-JSON" target="_blank">Ext.JSON</a></h1></div><div id="docContent"><div id="doc-overview-content"><div class="lft"><p>Modified version of Douglas Crockford"s json.js that doesn"t
mess with the Object prototype
http://www.json.org/js.html</p>
<div class="members"><div class="m-methods"><a name="methods"></a><div class="definedBy">Defined By</div><h3 class="mth p">Methods</h3><div id="method-decode" class="member f ni"><a href="Ext.JSON.html#method-decode" rel="method-decode" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.JSON.html" class="definedIn docClass">Ext.JSON</a><br/><a href="../source/JSON3.html#Ext-JSON-method-decode" class="viewSource">view source</a></div><a name="decode"></a><a name="method-decode"></a><a href="Ext.JSON.html#" rel="method-decode" class="cls expand">decode</a>(
<span class="pre">String json, [Boolean safe]</span>)
 : Object</div><div class="description"><div class="short">Decodes (parses) a JSON string to an object. If the JSON is invalid, this function throws a SyntaxError unless the sa...</div><div class="long"><p>Decodes (parses) a JSON string to an object. If the JSON is invalid, this function throws a SyntaxError unless the safe option is set.</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">json</span> : String<div class="sub-desc"><p>The JSON string</p>
</div></li><li><span class="pre">safe</span> : Boolean<div class="sub-desc"><p>(optional) Whether to return null or throw an exception if the JSON is invalid.</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Object</span>&nbsp; &nbsp;<p>The resulting object</p>
</li></ul></div></div></div><div id="method-encode" class="member ni"><a href="Ext.JSON.html#method-encode" rel="method-encode" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.JSON.html" class="definedIn docClass">Ext.JSON</a><br/><a href="../source/JSON3.html#Ext-JSON-method-encode" class="viewSource">view source</a></div><a name="encode"></a><a name="method-encode"></a><a href="Ext.JSON.html#" rel="method-encode" class="cls expand">encode</a>(
<span class="pre">Mixed o</span>)
 : String</div><div class="description"><div class="short"><p>Encodes an Object, Array or other value</p>
</div><div class="long"><p>Encodes an Object, Array or other value</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">o</span> : Mixed<div class="sub-desc"><p>The variable to encode</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">String</span>&nbsp; &nbsp;<p>The JSON string</p>
</li></ul></div></div></div><div id="method-encodeDate" class="member ni"><a href="Ext.JSON.html#method-encodeDate" rel="method-encodeDate" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.JSON.html" class="definedIn docClass">Ext.JSON</a><br/><a href="../source/JSON3.html#Ext-JSON-method-encodeDate" class="viewSource">view source</a></div><a name="encodeDate"></a><a name="method-encodeDate"></a><a href="Ext.JSON.html#" rel="method-encodeDate" class="cls expand">encodeDate</a>(
<span class="pre">Date d</span>)
 : String</div><div class="description"><div class="short">Encodes a Date. This returns the actual string which is inserted into the JSON string as the literal expression.
The ...</div><div class="long"><p>Encodes a Date. This returns the actual string which is inserted into the JSON string as the literal expression.
<b>The returned value includes enclosing double quotation marks.</b></p>


<p>The default return format is "yyyy-mm-ddThh:mm:ss".</p>


<p>To override this:</p>


<pre><code>     Ext.JSON.encodeDate = function(d) {
     return d.format('"Y-m-d"');
     };
     </code></pre>

<h3 class="pa">Parameters</h3><ul><li><span class="pre">d</span> : Date<div class="sub-desc"><p>The Date to encode</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">String</span>&nbsp; &nbsp;<p>The string literal to use in a JSON string.</p>
</li></ul></div></div></div></div></div></div></div><div id="pageContent"></div></div></div></div></body></html>